package br.com.loja.view.swing.model;

import java.awt.event.ActionListener;
import javax.swing.JToolBar;
import br.com.loja.util.i18n.Language;

/**
 * @brief Classe DefaultToolBarEditor
 * @author David Luiz
 * @date 25/11/2014
 */
public class DefaultToolBarEditor extends JToolBar {

    private javax.swing.JButton btAlterar;
    private javax.swing.JButton btCancelar;
    private javax.swing.JButton btGravar;
    private javax.swing.JButton btNovo;
    private javax.swing.JButton btRemover;
    private javax.swing.Box.Filler filler1;
    private javax.swing.Box.Filler filler2;
    private Language language;

    public DefaultToolBarEditor() {
        initComponents(null);
    }

    public DefaultToolBarEditor(ActionListener listener) {
        initComponents(listener);

    }

    private void initComponents(ActionListener listener) {
        language = Language.getInstance();

        btNovo = new javax.swing.JButton();
        filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(12, 0), new java.awt.Dimension(12, 0), new java.awt.Dimension(12, 32767));
        btAlterar = new javax.swing.JButton();
        btRemover = new javax.swing.JButton();
        filler2 = new javax.swing.Box.Filler(new java.awt.Dimension(24, 0), new java.awt.Dimension(24, 0), new java.awt.Dimension(24, 32767));
        btGravar = new javax.swing.JButton();
        btCancelar = new javax.swing.JButton();

        setFloatable(false);
        setRollover(true);

        btNovo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/img/Deep_Add.png"))); // NOI18N
        btNovo.setText(language.getString("new"));
        btNovo.setActionCommand("novo");
        btNovo.addActionListener(listener);
        add(btNovo);
        add(filler1);

        btAlterar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/img/Deep_Edit.png"))); // NOI18N
        btAlterar.setText(language.getString("edit"));
        btAlterar.setActionCommand("alterar");
        btAlterar.setEnabled(false);
        btAlterar.addActionListener(listener);
        add(btAlterar);

        btRemover.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/img/Deep_Delete.png"))); // NOI18N
        btRemover.setText(language.getString("remove"));
        btRemover.setActionCommand("remover");
        btRemover.addActionListener(listener);
        btRemover.setEnabled(false);
        add(btRemover);
        add(filler2);

        btGravar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/img/Deep_Accept.png"))); // NOI18N
        btGravar.setText(language.getString("save"));
        btGravar.setActionCommand("gravar");
        btGravar.setEnabled(false);
        btGravar.addActionListener(listener);
        add(btGravar);

        btCancelar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/img/Deep_Cancel.png"))); // NOI18N
        btCancelar.setText(language.getString("cancel"));
        btCancelar.setActionCommand("cancelar");
        btCancelar.setEnabled(false);
        btCancelar.addActionListener(listener);
        add(btCancelar);
    }

    /**
     * @return the btAlterar
     */
    public javax.swing.JButton getBtAlterar() {
        return btAlterar;
    }

    /**
     * @return the btCancelar
     */
    public javax.swing.JButton getBtCancelar() {
        return btCancelar;
    }

    /**
     * @return the btGravar
     */
    public javax.swing.JButton getBtGravar() {
        return btGravar;
    }

    /**
     * @return the btNovo
     */
    public javax.swing.JButton getBtNovo() {
        return btNovo;
    }

    /**
     * @return the btRemover
     */
    public javax.swing.JButton getBtRemover() {
        return btRemover;
    }

}
